package cn.wolfcode.domain;

import cn.wolfcode.query.JsonResult;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
@ToString
public class Notice {
    private Long id;
    private Employee issuer;	// 发布人
    private Date pubdate;       // 发布时间
    private String title;       // 标题
    private String content;     // 内容
	private boolean status;		// 已知/未知

	public String getJson(){
		Map<String,Object> map = new HashMap<>();
		map.put("id",id);
		map.put("pubdate",pubdate);
		map.put("title",title);
		map.put("content",content);
		if(issuer != null){
			map.put("issuerId",issuer.getId());
			map.put("issuerName",issuer.getName());
		}
		return JSON.toJSONString(map);
	}
}